package com.xinian.springclud_demo.controller;

import com.xinian.springclud_demo.common.Result;
import com.xinian.springclud_demo.exception.BusinessException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestException {
    @GetMapping("/a")
    public Result query(){
        int i=1/0;
        Result result = new Result(true,"好",200,"hh");
        return result;
    }

    @GetMapping("/b")
    public Result query1(){
        throw new BusinessException(504,"自定义异常处理");

    }



}
